package STO_68_1;

import LCommon.TreeNode;

public class Solution {
	public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) {
		
		while (root != null) {
			if (p.val<root.val&&q.val<root.val) {
				root=root.left;
			}else if(p.val>root.val&&q.val>root.val) {
				root=root.right;
			}else {
				break;
			}
		}
		return root;
	}
}
